# Tem IRC common commands class
# Tem version: 0.3
# Description:
#  This class provides some basicly needed IRC commands and can be used global (by modules too)

class IRCCommands
	def initialize(socket_ptr)
		@socket_handle = socket_ptr
	end

	def send_pong(line)
		pong_data = line.length+1
		@socket_handle.print "PONG #{pong_data}\r\n"
	end

	def join(chan)
		@socket_handle.print "JOIN #{chan}\r\n"
	end

	def part(chan)
		@socket_handle.print "PART #{chan}\r\n"
	end

	def privmsg(subject, msg)
		@socket_handle.print "PRIVMSG #{subject} :#{msg}\r\n"
	end

	def action(subject, action_)
		@socket_handle.print "PRIVMSG #{subject} :#{$SPECIAL}ACTION #{action_}#{$SPECIAL}\r\n"
	end

	def quit_msg(msg)
		@socket_handle.print "QUIT :#{msg}"
	end
	
	def do_chanmode(subject, mode, mode_subjects)
		prnt "MODE #{subject} #{mode} #{mode_subjects}"
		@socket_handle.print "MODE #{subject} #{mode} #{mode_subjects}\r\n"
	end
end
